

<%@ page import="com.auctionhaus.Customer" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'customer.label', default: 'Customer')}" />
        <title><g:message code="default.edit.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="body">
            <h1><g:message code="default.edit.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${customerInstance}">
            <div class="errors">
                <g:renderErrors bean="${customerInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <g:hiddenField name="id" value="${customerInstance?.id}" />
                <g:hiddenField name="version" value="${customerInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                            <div class="formField" align="right">
                              <label for="emailAddress">Email Address:</label>
                              <g:textField name="emailAddress" value="${customerInstance?.emailAddress}" />
                            </div>
                            <div class="formField" align="right">
                                  <label for="password">Password:</label>
                                  <g:passwordField name="password" value="${customerInstance?.password}"/>
                            </div>
                            <g:if test="${session.customer?.isAdminRole()}">
                                <div align="right" >
                                    <g:checkBox name="adminRole" value="${customerInstance?.adminRole}"/>
                                    <label for="adminRole" align="left">Enable Admin Privileges</label>
                                </div>
                            </g:if>
                            <div class="formField" align="right">
                                <g:datePicker name="date" value="${new Date()}"/>
                            </div>

                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span>
                    <g:if test="${session?.customer?.isAdminRole() && session?.customer?.getId() != customerInstance.getId()}">
                          <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
                    </g:if>
                </div>
            </g:form>
        </div>
    </body>
</html>
